/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.posplus.losspreventiondataimporter.service;

import com.posplus.lossprevention.APDAOFactory;
import com.posplus.lossprevention.dao.ItemsDAO;
import com.posplus.lossprevention.mapping.Items;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author scottw
 */
public class ItemsService {

    private ItemsDAO itemDAO;
    
    public ItemsService(APDAOFactory lpFactory) {
        this.itemDAO = lpFactory.getItemsDAO();
    }
    
    public ItemsService(ItemsDAO itemsDAO){
        this.itemDAO = itemsDAO;
    }

    public void bulkInsert(List<Items> items) {
        itemDAO.bulkInsert(items);
    }

    public void saveAll(List<Items> items) {
        Iterator<Items> iter = items.iterator();
        while (iter.hasNext()) {
           itemDAO.save(iter.next());
            
        }
    }
}
